var ICOPMobile = ICOPMobile || {};

//获取url中search中的参数
ICOPMobile.GetRequest = (function() {
    var url = location.search;
    var theRequest = new Object();
    if (url.indexOf("?") != -1) {
        var str = url.substr(1);
        strs = str.split("&");
        for(var i = 0; i < strs.length; i ++) {
            theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
        }
    }
    return theRequest;
});

//获取url中所有的参数（改良版）
//兼容--在#路由下参数在路由之前，放在路由之后获取不到
ICOPMobile.GetAllRequest = (function() {
    var theRequest = new Object();
    var url = location.href;//直接获取href中的参数，不从search中获取
    if (url.indexOf("?") != -1) {
        var str = url.split('?')[1];
        str = str.split('#')[0];
        if (url.split('?').length > 2) {
            var str2 = url.split('?')[2];
            str = str + '&' + str2;
        }
        strs = str.split("&");
        for (var i = 0; i < strs.length; i++) {
            var eqIndex = strs[i].indexOf("=");
            theRequest[strs[i].split("=")[0]] = unescape(strs[i].substr(eqIndex + 1));
        }
    }
    return theRequest;
});



